﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IllustratedCsharp7_ch21
{
    class Simple
    {
        Stopwatch sw = new Stopwatch();
        public void DoRun()
        {
            Console.WriteLine("Caller:Before call");
            ShowDelayAsync();
            Console.WriteLine("Caller:After call");
        }
        private async void ShowDelayAsync()
        {
            sw.Start();
            Console.WriteLine($"     Before Delay: {sw.ElapsedMilliseconds}");
            await Task.Delay(1000);
            Console.WriteLine($"     After Delay :{sw.ElapsedMilliseconds}");
        }
    }
    class Chapt21_3_5TaskDelayMethod
    {
        static void _Main()
        {
            Simple ds = new Simple();
            ds.DoRun();
            Console.Read();
        }
    }
}
